import 'dart:convert';

import 'package:flutter_base/generated/json/base/json_field.dart';
import 'package:flutter_base/generated/json/common_website_entity.g.dart';

export 'package:flutter_base/generated/json/common_website_entity.g.dart';

//常用网站数组
class CommonWebsiteListData {
  List<CommonWebsiteEntity>? list;

  CommonWebsiteListData.fromJson(dynamic json) {
    list = [];
    if (json is List) {
      for (var element in json) {
        list?.add(CommonWebsiteEntity.fromJson(element));
      }
    }
  }
}

@JsonSerializable()
class CommonWebsiteEntity {
  late String category = '';
  late String icon = '';
  late double id;
  late String link = '';
  late String name = '';
  late double order;
  late double visible;

  CommonWebsiteEntity();

  factory CommonWebsiteEntity.fromJson(Map<String, dynamic> json) =>
      $CommonWebsiteEntityFromJson(json);

  Map<String, dynamic> toJson() => $CommonWebsiteEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
